package com.jincheng.system.service.impl;

import com.jincheng.common.utils.DateUtils;
import com.jincheng.system.domain.Registration;
import com.jincheng.system.mapper.RegistrationMapper;
import com.jincheng.system.service.IRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户信息Service业务层处理
 *
 * @author DairyJay
 * @date 2024-12-29
 */
@Service
public class RegistrationServiceImpl implements IRegistrationService {
    private final RegistrationMapper registrationMapper;

    public RegistrationServiceImpl(RegistrationMapper registrationMapper) {
        this.registrationMapper = registrationMapper;
    }

    /**
     * 查询用户信息
     *
     * @param registrationId 用户信息主键
     * @return 用户信息
     */
    @Override
    public Registration selectRegistrationByRegistrationId(Long registrationId) {
        return registrationMapper.selectRegistrationByRegistrationId(registrationId);
    }

    /**
     * 查询用户信息列表
     *
     * @param registration 用户信息
     * @return 用户信息
     */
    @Override
    public List<Registration> selectRegistrationList(Registration registration) {
        return registrationMapper.selectRegistrationList(registration);
    }

    /**
     * 新增用户信息
     *
     * @param registration 用户信息
     * @return 结果
     */
    @Override
    public int insertRegistration(Registration registration) {
        registration.setCreateTime(DateUtils.getNowDate());
        return registrationMapper.insertRegistration(registration);
    }

    /**
     * 修改用户信息
     *
     * @param registration 用户信息
     * @return 结果
     */
    @Override
    public int updateRegistration(Registration registration) {
        registration.setUpdateTime(DateUtils.getNowDate());
        return registrationMapper.updateRegistration(registration);
    }

    /**
     * 批量删除用户信息
     *
     * @param registrationIds 需要删除的用户信息主键
     * @return 结果
     */
    @Override
    public int deleteRegistrationByRegistrationIds(Long[] registrationIds) {
        return registrationMapper.deleteRegistrationByRegistrationIds(registrationIds);
    }

    /**
     * 删除用户信息信息
     *
     * @param registrationId 用户信息主键
     * @return 结果
     */
    @Override
    public int deleteRegistrationByRegistrationId(Long registrationId) {
        return registrationMapper.deleteRegistrationByRegistrationId(registrationId);
    }
}
